Ext.define('DragonApp.view.cron.Grid', {
    extend: 'Ext.grid.Panel',

    alias: ['widget.crongrid'],

    requires: [
        'DragonApp.store.Cron',
        'DragonApp.view.cron.Controller'
    ],

    //title: '计划任务日志',

    controller: 'cron',

    columns: [
        { text: '序号', xtype: 'rownumberer', width: 80, align: 'center' },
        { text: 'ID', dataIndex: 'id', align: 'center', width: 100, hidden: true, hideable: false },
        { text: '任务类型', dataIndex: 'type', renderer: 'typeRender', align: 'center', width: 100, hideable: false },
        { text: '开始时间', dataIndex: 'start_at', align: 'center', width: 145, hideable: false },
        { text: '结束时间', dataIndex: 'end_at', align: 'center', width: 145, hideable: false },
        { text: '持续时间(秒)', dataIndex: 'last_time', align: 'center', width: 120, hideable: false },
        { text: '使用内存', dataIndex: 'mem_use', align: 'center', width: 120, hideable: false },        
        { text: '区间内存', dataIndex: 'mem_range', align: 'center', width: 120, hideable: false },
        { text: '高峰内存', dataIndex: 'mem_peak', align: 'center', width: 120, hideable: false },
        { text: '备注', dataIndex: 'comments', renderer: 'commentsRender', hideable: false, align: 'center', flex: 1 },
        { text: '创建时间', dataIndex: 'create_time', align: 'center', width: 144, hideable: false },
        { text: '更新时间', dataIndex: 'update_time', align: 'center', width: 144, hideable: false }
    ],
    store: {
        type: 'cronStore',
        storeId : 'cronStore'
    },

    selModel: {
        selType: 'checkboxmodel'
    },

    initComponent: function() {
        var me = this;
        me.tbar = [
            {
                xtype: 'button',
                text: '批量删除',
                itemId: 'batdelete',
                tooltip: '批量删除',
                handler: 'onBatDelete',
                glyph: 'xf014@FontAwesome',
                width: 100
            },{
                xtype: 'button',
                text: '刷新列表',
                tooltip: 'Refresh',
                handler: 'onRefresh',
                glyph: 'xf021@FontAwesome',
                width: 100
            }/*,'->', {
                xtype: 'textfield',
                name: 'searchfield',
                itemId: 'search_field',
                emptyText: '请输入筛选关键字',
                listeners: {
                    specialKey: 'onTextFieldSpecialKeySearch'
                }
            }, {
                xtype: 'button',
                itemId: 'search_btn',
                text: '搜索',
                reference: 'search',
                iconCls: 'fa fa-search fa-lg buttonIcon',
                listeners: {
                    click: 'onSearch'
                }
            }*/
        ];
        me.callParent(arguments);
        //========
        //权限控制
        //========
        if ('系统用户' == sessionStorage.getItem("DragonApp_role_name")) {
            me.queryById('delete').hide();
        }
    }
});